package com.zzyl.nursing.job;

import com.zzyl.nursing.service.IContractService;
import com.zzyl.nursing.service.IReservationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @author wys
 * @version V1.0
 * @date 2025-02-27 17:25
 */
@Component("myJob")
@Slf4j
public class MyJob {
    @Autowired
    private IContractService contractService;

    @Autowired
    private IReservationService reservationService;

    public void test(){
        log.info("定时任务执行:{}", LocalDateTime.now());
    }

    public void updateContractStatus(){
        contractService.updateContractStatus();
        log.info("定时更新合同状态成功！");
    }

    public void updateReservationStatus(){
        reservationService.updateReservationStatus();
        log.info("定时更新预约状态成功！");
    }
}
